package com.urea.system.service.impl;

import java.util.List;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.urea.system.mapper.TerminalConfigMapper;
import com.urea.system.domain.TerminalConfig;
import com.urea.system.service.ITerminalConfigService;

/**
 * 终端配置Service业务层处理
 *
 * @author liuzd
 * @date 2023-08-01
 */
@Service
public class TerminalConfigServiceImpl extends ServiceImpl<TerminalConfigMapper, TerminalConfig> implements ITerminalConfigService {
    @Autowired
    private TerminalConfigMapper terminalConfigMapper;

    /**
     * 查询终端配置
     *
     * @param id 终端配置主键
     * @return 终端配置
     */
    @Override
    public TerminalConfig selectTerminalConfigById(Long id) {
        return terminalConfigMapper.selectTerminalConfigById(id);
    }

    /**
     * 查询终端配置列表
     *
     * @param terminalConfig 终端配置
     * @return 终端配置
     */
    @Override
    public List<TerminalConfig> selectTerminalConfigList(TerminalConfig terminalConfig) {
        return terminalConfigMapper.selectTerminalConfigList(terminalConfig);
    }

    /**
     * 新增终端配置
     *
     * @param terminalConfig 终端配置
     * @return 结果
     */
    @Override
    public int insertTerminalConfig(TerminalConfig terminalConfig) {
        return terminalConfigMapper.insertTerminalConfig(terminalConfig);
    }

    /**
     * 修改终端配置
     *
     * @param terminalConfig 终端配置
     * @return 结果
     */
    @Override
    public int updateTerminalConfig(TerminalConfig terminalConfig) {
        return terminalConfigMapper.updateTerminalConfig(terminalConfig);
    }

    /**
     * 批量删除终端配置
     *
     * @param ids 需要删除的终端配置主键
     * @return 结果
     */
    @Override
    public int deleteTerminalConfigByIds(Long[] ids) {
        return terminalConfigMapper.deleteTerminalConfigByIds(ids);
    }

    /**
     * 删除终端配置信息
     *
     * @param id 终端配置主键
     * @return 结果
     */
    @Override
    public int deleteTerminalConfigById(Long id) {
        return terminalConfigMapper.deleteTerminalConfigById(id);
    }

    @Override
    public TerminalConfig getByTerminalId(Long terminalId) {
        return lambdaQuery().eq(TerminalConfig::getTerminalId, terminalId).one();
    }
}
